package _2021;

/**
 * @author ShadowLim
 * @create 2022-03-29-20:28
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * 杨辉三角形
 */
public class Main {

    public static void main(String[] args) {
        InputStream inputStream=System.in;
        OutputStream outputStream = System.out;
        InputReader in=new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Prob solver = new Prob();
        solver.solve(1, in, out);
        out.flush();
        out.close();
    }
    static class Prob{
        int N;
        int[] ans = {0, 1, 5, 8, 12, 17, 13, 30, 38, 47, 18};   //前10
        public void solve(int testCases, InputReader in, PrintWriter out) {
            N = in.nextInt();
            if(N <= 10) out.print(ans[N]);  //优化
            else out.print(process(N));
        }
        private long process(int n) {
            for(int i = 16; i > 1; --i) {   // 第 i 列
                for(int j = 2 * i; ; ++j) {     // 每列最小有效行
                    long res = C(j, i);
                    if (res == n) {
//                        System.out.println((j+1) + "行 " + (i+1) + " 列");
                        return j * (1 + j) / 2 + i + 1;
                    } else if(res > n)
                        break;
                }
            }
//            System.out.println((n+1) + "行 " + "2 列 out of for " + ((long)n * (1 + n) / 2 + 2));
            return (long)n * (1 + n) / 2 + 2;
        }
        private long C(int n, int k) {  // 查找第n行第k列的值
            if(k == 0 || n == 0) return 0;
            long res = 1;
            for(int ni = n - k + 1, ki = 1; ni<=n && ki <= k; ++ni, ++ki) {
                res = res * ni / ki;    //优化
                if(res > N)
                    return res;     // 优化
            }
            return res;
        }
    }
    static class InputReader{
        BufferedReader br;
        StringTokenizer st;
        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = null;
        }
        public String next() {
            while(st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

